<?php
class score extends ujn_controller {
	var $auto_render = false;
	
	public function lists() {
		$data = array(
			'flag' => 1,
			'lists' => mdl_global_score::getInstance()->getAll(),
		);
		echo json_encode( $data );
	}
	
	public function get(){
		$data = array(
			'flag' => 1,
			'lists' => mdl_global_score::getInstance()->getPID( $_POST['scid'] ),
		);
		echo json_encode($data);
	}
	
	public function add() {
		$data = array(
			'flag' => mdl_global_score::getInstance()->edit(
						$_POST['type'], $_POST['name'], $_POST['achive'], $_POST['desc'])
		);
		echo json_encode( $data );
	}

	public function edit() {
		$data = array(
			'flag' => mdl_global_score::getInstance()->edit(
						$_POST['type'], $_POST['name'], $_POST['achive'], $_POST['desc'], $_POST['scid']) 
		);
		echo json_encode( $data );
	}
}